Fix error messages for sub-device access of setters#828
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a dedicated exception type to provide clearer, user-facing errors when attempting to modify configuration attributes on sub-devices (which is not supported), and adds tests covering these behaviors.
Changes:
- Added
NotImplementedOnSubdeviceError(anAlarmBase) with a clearer message for unsupported sub-device config operations. - Added sub-device guards to multiple config setters / helpers (e.g.,
enabled,read_only,readout_priority, limits, tags, user parameters). - Added tests that exercise sub-device reads (allowed) vs. writes (now raising the new exception).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
bec_lib/bec_lib/device.py |
Adds NotImplementedOnSubdeviceError and raises it from various config setters when called on sub-devices. |
bec_lib/tests/test_devices.py |
Adds fixtures/tests to verify sub-device config setters raise NotImplementedOnSubdeviceError. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
6d73eb2 to
bc628b1
Compare
d-perl
left a comment
There was a problem hiding this comment.
looks good to me, one comment in code which could save a couple of lines if you wanted, optional
41076db to
8670499
Compare
|
PR somehow stuck, gonna open a new one. |
Changing config attributes of sub-devices is not supported for RPC devices, i.e. read_only, readoutPriority, limits etc. Previously, the error message for this was rather obscure:
This PR fixes this. Error messages for access of relevant attributes of sub-devices has been improved.